package com.pur.zsms.photomanage.dao.impl;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Query;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.pur.zsms.common.dao.GenericDao;
import com.pur.zsms.common.dao.JpaTemplate;
import com.pur.zsms.common.exception.GenericException;
import com.pur.zsms.common.support.PageController;
import com.pur.zsms.common.support.PaginationSupport;
import com.pur.zsms.foodmanage.food.dao.IFoodDao;
import com.pur.zsms.foodmanage.food.po.FoodMaterPo;
import com.pur.zsms.foodmanage.food.po.FoodPo;
import com.pur.zsms.foodmanage.food.vo.FoodMaterVo;
import com.pur.zsms.foodmanage.food.vo.FoodVo;
import com.pur.zsms.matermanage.mater.po.MaterLevelPo;
import com.pur.zsms.photomanage.dao.IPhotoDao;
import com.pur.zsms.photomanage.po.PhotoPo;
import com.pur.zsms.photomanage.vo.PhotoVo;
import com.pur.zsms.pmsnmanage.menu.po.MenuPo;
import com.pur.zsms.pmsnmanage.role.vo.RoleVo;
import com.pur.zsms.pmsnmanage.user.dao.IUserDao;
import com.pur.zsms.pmsnmanage.user.po.UserPo;
import com.pur.zsms.pmsnmanage.user.po.UserRolePo;
import com.pur.zsms.pmsnmanage.user.vo.UserVo;
import com.pur.zsms.systemsetting.datadictionary.po.CodeType;

@Repository("photoDao")
public class PhotoDaoImpl extends GenericDao implements IPhotoDao {
	public PaginationSupport findPhoto(PageController pageController, PhotoVo photoVo)
	        throws GenericException {
		StringBuffer ql = new StringBuffer();
		ql.append("SELECT t.mater_id,t.photo_id,t.fist_flag,m.mater_name FROM t_photo t,t_material m WHERE m.mater_id =t.mater_id");
		return this.findByNativeQuery(ql.toString(), pageController);
	}

	public PhotoPo addPhotoPo(PhotoPo c) throws GenericException {
		this.persist(c);
		return c;
	}

}
